/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.util.Date;

/**
 * <p>Project: jse2303 - Str5
 * <p>Powered by webrx On 2023-07-17 14:24:37
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Str5 {
    public static void main(String[] args) {
        String code = "//检查字符串在另一个字符串出现的次数\n" +
                "        String s = \"java\";\n" +
                "        String s2 = \"java,hello,java!!java8-javascript,jav\";\n" +
                "        int pos = s2.indexOf(s);\n" +
                "        int n = 0;\n" +
                "        while (pos != -1) {\n" +
                "            ++n;\n" +
                "            pos = s2.indexOf(s, pos + s.length());\n" +
                "        }\n" +
                "        System.out.println(n);";
        System.out.println(code);
        System.out.println(code.lines().count());
        System.out.println("-".repeat(15));

        //blocktext
        String sc = """
                //检查字符串在另一个字符串出现的次数
                String s = "java";
                String s2 = "java,hello,java!!java8-javascript,jav";
                int pos = s2.indexOf(s);
                int n = 0;
                while (pos != -1) {
                    ++n;
                    pos = s2.indexOf(s, pos + s.length());
                }
                System.out.println(n);
                """;
        System.out.println(sc);
        System.out.println(sc.lines().count());

        System.out.println("星期".concat(String.valueOf("日一二三四五六".charAt(new Date().getDay()))));


        System.out.println("aaa" instanceof String);
        Object i = 6;
        System.out.println(i instanceof String);
        Date d = new Date();
        System.out.println(d instanceof Date);
    }
}
